﻿using System;
using System.Data;
using System.Data.Common;
using Deeper.Common;
namespace Deeper.DataAccess
{
	public interface IDataContext
	{

		/// <summary>
		/// 获取整型自定义序列号
		/// </summary>
		/// <param name="tableName"></param>
		/// <returns></returns>
		int GetSequenceSql(string tableName);

		 

		/// <summary>
		/// 执行sql，返回影响行数
		/// </summary>
		/// <param name="strSql"></param>
		/// <param name="parameterValues"></param>
		/// <returns></returns>
		int ExecuteSql(string strSql, params object[] parameterValues);
		/// <summary>
		/// 执行sql，返回影响行数
		/// </summary>
		/// <param name="strSql"></param>
		/// <param name="cmdParams"></param>
		/// <returns></returns>
		int ExecuteSql(string strSql, ref MyDbParams[] cmdParams);

		/// <summary>
		/// 执行sql，返回第一行第一列的值
		/// </summary>
		/// <typeparam name="T"></typeparam>
		/// <param name="strSql"></param>
		/// <param name="paramterValues"></param>
		/// <returns></returns>
		T GetSingle<T>(string strSql, params object[] paramterValues) where T : new();
		/// <summary>
		/// 执行sql，返回第一行，第一列的值
		/// </summary>
		/// <typeparam name="T"></typeparam>
		/// <param name="strSql"></param>
		/// <param name="cmdParams"></param>
		/// <returns></returns>
		T GetSingle<T>(string strSql, ref MyDbParams[] cmdParams) where T : new();
		/// <summary>
		/// 执行sql，返回DataSet
		/// </summary>
		/// <param name="strSql"></param>
		/// <param name="paramterValues"></param>
		/// <returns></returns>
		DataSet GetDataset(string strSql, string where, string orderBy, params object[] paramterValues);
		DataTable GetPageDatatableByCustom(int pageIndex, int pageSize, string strSql, string where, string orderby, params object[] param);

		int GetCount(string sql, string where, params object[] param);

		bool TestConnect();
	}


}
